package main

import (
	"log"
	"net/rpc"
)

type (
	Req struct {
		Id string
	}

	Resp struct {
		Id    string
		Name  string
		Phone string
	}
)

func main() {
	client, err := rpc.Dial("tcp", ":8080")
	if err != nil {
		log.Fatal("连接服务端失败", err)
	}
	defer client.Close()
	var resp Resp
	if err := client.Call("UserService.GetUserInfo", Req{Id: "2"}, &resp); err != nil {
		log.Fatal("调用服务端方法失败", err)
	}
	log.Println(resp)
}
